package com.example.demo.service;

import com.example.demo.mapper.UserMapper;
import com.example.demo.model.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User:xieChao
 * Date:2022/12/24 20:54
 */
@Service
public class UserService {
    @Resource
    private UserMapper userMapper;
    public UserInfo login(String loginname,String password){

        return userMapper.login(loginname,password);
    }

    public List<UserInfo> getAll(){
        return userMapper.getAll();
    }

    public int add(UserInfo userInfo){
        return userMapper.add(userInfo);
    }
//查询
    public UserInfo getUserByLoginName(String loginname){
        return userMapper.getUserByLoginname(loginname);

    }

    public UserInfo getUserByUid(Integer uid){
        return userMapper.getUserByUid(uid);
    }
    public int update(UserInfo userInfo){
        return userMapper.update(userInfo);
    }

    public int del(Integer uid){
        return userMapper.del(uid);
    }

    public int dels(List<Integer> ids){
        return userMapper.dels(ids);
    }

    public List<UserInfo> getListByPage(String username,
                                        String address,
                                        String email,
                                        Integer limit,
                                        Integer offset) {
        return userMapper.getListByPage(username, address, email, limit, offset);
    }

    public int getListByPageCount(String username,
                                  String address,
                                  String email) {
        return userMapper.getListByPageCount(username, address, email);
    }
}
